import Utils from "../../core/utils";

export class GameUtils {
  static InstantiateCCGame(name: string): cc.Node {
    const prefab = Utils.loader.getAsset<cc.Prefab>(name, "cc_game", "cc.Prefab");
    if (!prefab) {
      console.error(`GameUtils::InstantiateCCGame, 没有找到${name}`);
    }
    return cc.instantiate(prefab);
  }
  static InstantiateCCGameCom<T extends cc.Component>(name: string, comType: { prototype: T }): T {
    let node = this.InstantiateCCGame(name);
    return node.getComponent(comType);
  }
};